﻿using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

namespace GC2.Funciones.General
{
    /// <summary>
    /// Funciones de uso comun en UserControls e Interfaces
    /// </summary> 
    public class FunctionsSite
    {
        public int CalculoEdad(DateTime dtFechaNac, DateTime dtNow)
        {
            try
            {
                TimeSpan span = (dtNow - dtFechaNac);
                int iEdad = (int)(span.Days / 365.25);
                return iEdad;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }

        public bool isNumeric(string dato)
        {
            try
            {
                double isItNumeric;
                return Double.TryParse(dato, System.Globalization.NumberStyles.Any, System.Globalization.NumberFormatInfo.InvariantInfo, out isItNumeric);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
    }
}